package com.ziyucoding.springboot.labs.jasypt.controller;

import com.ziyucoding.springboot.labs.jasypt.config.SystemConfig;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * jasypt 控制器
 *
 * @author ziyucoding
 * @date 2023-05-31
 **/
@RestController
@RequestMapping("/jasypt/")
public class JasyptController {

    @Resource
    private SystemConfig systemConfig;

    /**
     * 测试示例
     *
     * @return Map<String, Object>
     */
    @GetMapping("hello")
    public Map<String, Object> hello() {

        Map<String, Object> data = new HashMap<>();
        // 获取配置信息
        data.put("dbUserName", systemConfig.getUsername());

        Map<String, Object> result = new HashMap<>();
        result.put("code", 0);
        result.put("msg", "成功");
        result.put("data", data);
        return result;
    }


}
